Remote sensors, raster, and their properties

Remote sensing is the acquisition of information about an object without making physical contact with the object. Remote sensing is used in numerous fields, especially in the Earth Sciences. The remote sensors used to study the Earth surface record waves of the electromagnetic spectrum that entities on the land reflect (passive sensors) or send specific electromagnetic waves and record their rebound (active sensors). Most of the information from remote sensors (e.g.; imagery from optical and RaDAR satellites, aircraft photos, aircraft RaDAR, etc.) is packaged in raster formats (e.g.; .img, .grd, .asc, .sdat, .rst, .tif, .nc, .envi, .bil, etc.) (Cantly, 2006; Campbell & Wynne, 2011). A raster can be interpreted as a mathematical matrix where each grid (or pixel) represents the value that a remote sensors recorded in a specific area on the Earth’s surface. Rasters from optical satellites have four properties that define their capability to classify the Earth surface or to identify specific objects:

  1. Spatial resolution or spatial definition of the sensor. This is a measure of the area of the smallest dimension on the Earth’s surface over which an independent measurement can be made by the sensor.
  2. Spectral resolution, which refers to the ability of a sensor to define wavelength intervals (the bands of a multi-band raster) from the waves reflected by the Earth’s surface. The spectral resolution defines the variables (the bands of a raster) that will be used for the raster classification. Commonly used bands include RED, NEAR-INFRARED, BLUE, and GREEN bands of light.
  3. Radiometric resolution specifies how well the differences in brightness in every band of the image can be perceived. Radiometric resolution is measured through the number of bits (binary numbers) or the maximum number of the grey value levels per band. An 8 bit indicates that the sensor (e.g. Landsat satellite) has 256 grey values per band; a 16 bit (e.g. Sentinel-2) representation means that theoretically every band has 65,536 grey values. More bits means more information can be stored in each pixel.
  4. Temporal resolution refers to the frequency at which a specific sensor records information (images) of an area on Earth’s surface.

We, the users of raster imagery, play with these four properties to classify and model large areas of the Earth’s surface. In this tutorial, we are going to classify a Sentinel-2 image (optical satellite of the European Spatial Agency-ESA) corresponding to Camp Williams - Utah National Guard - located on the border between Salt Lake and Utah counties.

Figure 1. Camp Williams, UT (A) located on the border between Salt Lake and Utah counties (B). The sentinel image raster is showed in real color on B.

Figure 1. Camp Williams, UT (A) located on the border between Salt Lake and Utah counties (B). The sentinel image raster is showed in real color on B.

Our Sentinel-2 image raster has four bands (spectral resolution): . Blue (band 1) . Green (band 2) . Red (band 3) and . Near Infrared - NIR (band 4). The data has a spatial resolution of 10 meters and a spectral resolution 16 bits. The Sentinel-2 sensor has other bands in 20m; however, we will use only the four higher resolution bands for this assessment. You can review more information of Sentinel-2 mission here.


Classification of optical imagery

Based on the idea that different feature types (e.g. land cover types, such as, forest, urban, water bodies, etc.) on the Earth’s surface have different spectral reflectance, their recognition can be estimated by statistical classification processes. Image classification can be defined as the process of categorizing all pixels in a raster to obtain a set of land cover types or objectives. There are two types of classifications: unsupervised and supervised classification (Cantly, 2006).


Unsupervised classification

Unsupervised image classification are methods where an algorithm separates the pixels of a raster based on spectral statistics (using the band values) into classes or clusters with no other prior knowledge about Earth’s surface. Unsupervised classification is useful when you have limited information about the study area. Also, unsupervised classification can be applied before a supervised classifications help define land cover categories in a subsequent supervised classification (Cantly, 2006). One of the most frequent clustering methods used for unsupervised classification is K-means clustering. We also going to assess another method “clara” (Clustering for Large Applications) (Dahms, 2016).

K-means clustering

K-means clustering is a simple and elegant approach for partitioning a data set (grid or pixels values) into K distinct, non-overlapping clusters based their Euclidean distances (the straight-line distance between two pixels; which is estimate using Pythagorean metric or Pythagorean theorem). The pixels are located in a multi-dimensional plane where the axes represent the band values (four bands in our case). However, the graphic representation of the previous clustering is drawn in two (Figure 2) or three dimensions because the graphical representation of four of more dimension results impossible.

Figure 2: Clusterplot for twelve pixel cluster of the sentinel image raster of Camp Williams, UT (you are going to reproduce this clusterplot below). Each number and color represent a cluster; for instance, the pixel of the cluster 2 are represented in red using the number 2.

Figure 2: Clusterplot for twelve pixel cluster of the sentinel image raster of Camp Williams, UT (you are going to reproduce this clusterplot below). Each number and color represent a cluster; for instance, the pixel of the cluster 2 are represented in red using the number 2.

To perform K-means clustering, we must first specify the desired number of clusters K; then the K-means algorithm will assign each observation to exactly one of the K clusters. The cluster groups are assembled by minimizing the total variation within-cluster (usually the squared Euclidean distance) (See Hastie et al., 2009 for statistical details).

We will use the R packages 1) “raster” to read and manipulate the .img raster of the Sentinel-2 sensor, and 2) “cluster” to run the cluster classifications.

If you do not have these libraries in the R, installed them before run the command library: install.packages(“cluster”). You also need the package “sp” to load the package “raster”

library("sp")
library("raster")  
library("cluster")

to read the .img raster sentinel-2 and a smaller clip

Sentinel.img = stack("Sentinel2_20160605_10m.img")
Clip.Sentinel.img = stack("Clip_Sentinel2_20160605_10m.img")

By typing the name of the objet, Sentinel.img, you can see the properties and structure of the image.

Sentinel.img
## class       : RasterStack 
## dimensions  : 958, 1829, 1752182, 4  (nrow, ncol, ncell, nlayers)
## resolution  : 10, 10  (x, y)
## extent      : 404761, 423051, 4470769, 4480349  (xmin, xmax, ymin, ymax)
## coord. ref. : +proj=utm +zone=12 +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs 
## names       : Sentinel2_20160605_10m.1, Sentinel2_20160605_10m.2, Sentinel2_20160605_10m.3, Sentinel2_20160605_10m.4 
## min values  :                      674,                      596,                      356,                      297 
## max values  :                     6779,                     7079,                     7986,                     8318

To plot the raster in real color (RGB band order); r refer to the red band, g to the green one, and b to the #blue one.

plotRGB(Sentinel.img, r=3,g=2,b=1,stretch="hist")

To prepare the data for the classifications.

convert the raster data to a list of matrices with four matrices corresponding to the four bands

Sentinel.matrix = getValues(Sentinel.img)

You can see the structure of the list by typing str(). Also, you can observe the properties of the first band by typing Sentinel.img$“Sentinel2_20160605_10m.2”

str(Sentinel.matrix)
##  int [1:1752182, 1:4] NA NA NA NA NA NA NA NA NA NA ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : NULL
##   ..$ : chr [1:4] "Sentinel2_20160605_10m.1" "Sentinel2_20160605_10m.2" "Sentinel2_20160605_10m.3" "Sentinel2_20160605_10m.4"
Sentinel.img$"Sentinel2_20160605_10m.2"
## class       : RasterLayer 
## band        : 2  (of  4  bands)
## dimensions  : 958, 1829, 1752182  (nrow, ncol, ncell)
## resolution  : 10, 10  (x, y)
## extent      : 404761, 423051, 4470769, 4480349  (xmin, xmax, ymin, ymax)
## coord. ref. : +proj=utm +zone=12 +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs 
## data source : C:\TUTORIAL IMAGE CLASSIFICATION IN r\Third draff_Mar_23_2018\Sentinel2_20160605_10m.img 
## names       : Sentinel2_20160605_10m.2 
## values      : 596, 7079  (min, max)

To remove the NA-values

Sentinel.remove <- which(!is.na(Sentinel.matrix))# Select all the pixel with values different to NA
Sentinel.matrix <- na.omit(Sentinel.matrix)# it is for dealing with NAs; the function na.omit() returns the #object with incomplete cases removed

kmeans classification

For kmeans clustering of the matrix: 1) centers refer to the number of clusters, that is, the number of land cover categories that the researcher assumes is in the study area. 2) nstart refers to the number of random starts; a random set of (distinct) rows in the matrix is chosen as the initial centres (Hartigan & Wong, 1979).

Important note: You can running the command kmeans() with either Sentinel.img (whole the study area) or Clip.Sentinel.img (a smaller clip of about 20% of the study area). My computer takes 3 minutes to run Sentinel.img. My computer has 12 in RAM and the speed of the processor is 3.40 GHz.

set.seed(42) #To reproduce the same results 
k.classification = kmeans(Sentinel.matrix, centers=12, iter.max = 1000, nstart = 10,
                          algorithm="Lloyd")

To create the classified raster

kmeans_raster = raster(Sentinel.img)#To create a raster according to the Sentinel image called kmeans_raster
kmeans_raster[Sentinel.remove] <- k.classification$cluster # To add the classification for each pixel to the raster, taking out the pixels with NA values
plot(kmeans_raster)

If you want to export the raster product of your classification use the command writeRaster; HFA is the File type; each image format, in this case .img, has a file type. writeRaster(kmeans_raster, filename=“kmeans_raster.img”, format=“HFA”, overwrite=TRUE)


Supervised classification

Supervised image classification are methods where an algorithm separates the pixels of a raster based on the spectral signatures (spectral statistics of bands) defined in a training set (pixels corresponding to specific land cover categories that were confirmed in field). The use of supervised classification, therefore, requires groundtruth data from the field indicating land cover categories for a subset of the study area. Our training set is formed by 1883 samples. Each sample correspond to a pixel of the Sentinel-2 image that was evaluated on field to determine its land cover type. Researchers identified seven cover types based on vegetation: Deciduous Tree, Gambel Oak (a deciduous Quercus, common on alkaline soil), Juniper (an ever green conifer), Sagebrush (herbaceus species of Artemisia), Grassland, Bare (soil without vegetation), and developed (infrastructure).

The classification algorithm classifies each pixel of the raster resembling the band values in the groundtruth data.One of the most precise image classification algorithms is Random Forest (RF), a classification algorithm from the learning statistics. The RF algorithm operates by constructing a large number of decision trees from random subsets of predictor variables and the resulting classification consists of the modal response of all trees for a particular outcome (in our case every pixel) (Cutler et al., 2007; Freema et al., 2016). The Random forest algorithm was created by Leo Breiman and Adele Cutler (professor in the department of Mathematics and Statistics at USU) (Breiman & Cutler, 2018). In this tutorial, we will use the R packages ‘’randomForest’ (Breiman & Cutler, 2015) and “ModelMap” (Freema et al., 2016). The randomForest utility in R generates a default number of trees (500), using a subset of the samples (training subset) for every bootstrap iteration (a random resampling technique) and the square root of the number of predictors as the number of predictors used to identify a split at each node. This RF model provides accuracy estimates using OOB (or Out-of-Bag, an independent subset from the training data) (Cutler et al., 2007). The confusion matrix is built to estimate the accuracy, and from this confusion matrix are estimated Kappa (accuracy measure), omissions, and commissions. Kappa theoretically is categorized into the following ranges of agreement: poor K < 0.4, good K 0.4 < K< 0.75, excellent K > 0.7575 (Fielding & Bell, 1997).

The libraries

library("randomForest")
## randomForest 4.6-12
## Type rfNews() to see new features/changes/bug fixes.
library("ModelMap")
## Loading required package: rgdal
## rgdal: version: 1.2-11, (SVN revision 676)
##  Geospatial Data Abstraction Library extensions to R successfully loaded
##  Loaded GDAL runtime: GDAL 2.2.0, released 2017/04/28
##  Path to GDAL shared files: C:/Users/CamiloFagua/Documents/R/win-library/3.3/rgdal/gdal
##  Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
##  Path to PROJ.4 shared files: C:/Users/CamiloFagua/Documents/R/win-library/3.3/rgdal/proj
##  Linking to sp version: 1.2-5

1) Initialization

To fix the classification algorithm. “RF” means Random forest

model.type <- "RF"

To read training data set. It is a .csv file in the working directory (training_set_sentinel2.CSV)

qdatafn <- "training_set_sentinel2.CSV"

To name the outflies and set the directory

qdata.trainfn <- "VModelMapData_TRAIN_cathegorical.csv"
qdata.testfn <- "VModelMapData_TEST_cathegorical.csv"
folder <- getwd() # To set the folder where the outputs will be located 

The next command -get.test()- is to set 1) the percentage in the training set (proportion.test), 2) the training group (qdatafn), 3) the seed (The number used to initialize randomization to randomly select rows for a test data set. If you want to produce the same model later, use the same seed), 4) the name of the file output of training data (qdata.trainfn), 5) and the name of the file output of test data.You can use the help of R to a better understanding by using the command help(get.test).

get.test( proportion.test=0.2, 
          qdatafn=qdatafn,
          seed=10,
          folder=folder,
          qdata.trainfn=qdata.trainfn,
          qdata.testfn=qdata.testfn)

To name the model

MODELfn <- "VModelMapEx3"

To name the predictor variables (image bands)

predList <- c( "BLUE",
               "GREEN",
               "RED",
               "NIR"
)

To name the response variable and define its type in the R environment. Fiting a seed (seed <- 10) in order to get reproducible results. Remember the command help() to more information

response.name <- "cover"
response.type <- "categorical"
seed <- 10

To define the identifier (every row of the training data needs am identifies or “ID”).

unique.rowname <- "ID"

To code the image raster bands to the training data set

rastLUTfn <- "VModelMapData_LUT.csv" #VModelMapData_LUT.csv is another input in the working directory  
rastLUTfn <- read.table( rastLUTfn,
                         header=FALSE,
                         sep=",",
                         stringsAsFactors=FALSE)
rastLUTfn[,1] <- paste(folder,rastLUTfn[,1],sep="/")

1) Model creation.Remember the command help() to more information

model.obj.ex3 <- model.build( model.type=model.type,
                              qdata.trainfn=qdata.trainfn,
                              folder=folder,
                              unique.rowname=unique.rowname,
                              MODELfn=MODELfn,
                              predList=predList,
                              predFactor=FALSE,
                              response.name=response.name,
                              response.type=response.type,
                              seed=seed)
## mtry = 2  OOB error = 37.32% 
## Searching left ...
## mtry = 1     OOB error = 36.15% 
## 0.03116147 0.05 
## Searching right ...
## mtry = 4     OOB error = 35.94% 
## 0.0368272 0.05

2) Model diagnosis. The function model.diagnostics()runs the diagnostics of the model, creates graphs and tables of the results, and saves these graphs (as .jpg or .pdf) and tables (as .cvs) of the results in the working directory. The diagnostics of these models is evaluated with an independent test set by using cross-validation, or in the case of Random Forest Models, with Out OF Bag (OOB). Remember the command help() to more information.

model.pred.ex3 <- model.diagnostics( model.obj=model.obj.ex3,
                                     qdata.testfn=qdata.testfn,
                                     folder=folder,
                                     MODELfn=MODELfn,
                                     unique.rowname=unique.rowname,
                                     prediction.type="TEST", 
                                     device.type="jpeg",
                                     cex=1.2)
## [1] "LEVELS.pred:  Bare DeciduousTree Developed GambelOak Grassland Juniper Sagebrush"
## [1] "LEVELS.obs:   Bare DeciduousTree Developed GambelOak Grassland Juniper Sagebrush"

3) Map building

model.mapmake( model.obj=model.obj.ex3,
               folder=folder,
               MODELfn=MODELfn,
               rastLUTfn=rastLUTfn,
               na.action="na.omit")
## Warning in FNcheck(OUTPUTfn = OUTPUTfn, folder = folder, ERROR.NAME =
## "OUTPUTfn"): OUTPUTfn VModelMapEx3_map does not include an extension, using
## default extension of '.img'. New OUTPUTfn is VModelMapEx3_map.img
## [1] "starting production prediction"
## [1] "predFactor: "
## [1] "all predictor layer rasters match"
## [1] "brick done"
## [1] "write start C:/TUTORIAL IMAGE CLASSIFICATION IN r/Third draff_Mar_23_2018/VModelMapEx3_map.img"
## [1] "starting row by row predictions"
## [1] "     rows = 1"
## [1] "     rows = 2"
## [1] "     rows = 3"
## [1] "     rows = 4"
## [1] "     rows = 5"
## [1] "     rows = 6"
## [1] "     rows = 7"
## [1] "     rows = 8"
## [1] "     rows = 9"
## [1] "     rows = 10"
## [1] "     rows = 11"
## [1] "     rows = 12"
## [1] "     rows = 13"
## [1] "     rows = 14"
## [1] "     rows = 15"
## [1] "     rows = 16"
## [1] "     rows = 17"
## [1] "     rows = 18"
## [1] "     rows = 19"
## [1] "     rows = 20"
## [1] "     rows = 21"
## [1] "     rows = 22"
## [1] "     rows = 23"
## [1] "     rows = 24"
## [1] "     rows = 25"
## [1] "     rows = 26"
## [1] "     rows = 27"
## [1] "     rows = 28"
## [1] "     rows = 29"
## [1] "     rows = 30"
## [1] "     rows = 31"
## [1] "     rows = 32"
## [1] "     rows = 33"
## [1] "     rows = 34"
## [1] "     rows = 35"
## [1] "     rows = 36"
## [1] "     rows = 37"
## [1] "     rows = 38"
## [1] "     rows = 39"
## [1] "     rows = 40"
## [1] "     rows = 41"
## [1] "     rows = 42"
## [1] "     rows = 43"
## [1] "     rows = 44"
## [1] "     rows = 45"
## [1] "     rows = 46"
## [1] "     rows = 47"
## [1] "     rows = 48"
## [1] "     rows = 49"
## [1] "     rows = 50"
## [1] "     rows = 51"
## [1] "     rows = 52"
## [1] "     rows = 53"
## [1] "     rows = 54"
## [1] "     rows = 55"
## [1] "     rows = 56"
## [1] "     rows = 57"
## [1] "     rows = 58"
## [1] "     rows = 59"
## [1] "     rows = 60"
## [1] "     rows = 61"
## [1] "     rows = 62"
## [1] "     rows = 63"
## [1] "     rows = 64"
## [1] "     rows = 65"
## [1] "     rows = 66"
## [1] "     rows = 67"
## [1] "     rows = 68"
## [1] "     rows = 69"
## [1] "     rows = 70"
## [1] "     rows = 71"
## [1] "     rows = 72"
## [1] "     rows = 73"
## [1] "     rows = 74"
## [1] "     rows = 75"
## [1] "     rows = 76"
## [1] "     rows = 77"
## [1] "     rows = 78"
## [1] "     rows = 79"
## [1] "     rows = 80"
## [1] "     rows = 81"
## [1] "     rows = 82"
## [1] "     rows = 83"
## [1] "     rows = 84"
## [1] "     rows = 85"
## [1] "     rows = 86"
## [1] "     rows = 87"
## [1] "     rows = 88"
## [1] "     rows = 89"
## [1] "     rows = 90"
## [1] "     rows = 91"
## [1] "     rows = 92"
## [1] "     rows = 93"
## [1] "     rows = 94"
## [1] "     rows = 95"
## [1] "     rows = 96"
## [1] "     rows = 97"
## [1] "     rows = 98"
## [1] "     rows = 99"
## [1] "     rows = 100"
## [1] "     rows = 101"
## [1] "     rows = 102"
## [1] "     rows = 103"
## [1] "     rows = 104"
## [1] "     rows = 105"
## [1] "     rows = 106"
## [1] "     rows = 107"
## [1] "     rows = 108"
## [1] "     rows = 109"
## [1] "     rows = 110"
## [1] "     rows = 111"
## [1] "     rows = 112"
## [1] "     rows = 113"
## [1] "     rows = 114"
## [1] "     rows = 115"
## [1] "     rows = 116"
## [1] "     rows = 117"
## [1] "     rows = 118"
## [1] "     rows = 119"
## [1] "     rows = 120"
## [1] "     rows = 121"
## [1] "     rows = 122"
## [1] "     rows = 123"
## [1] "     rows = 124"
## [1] "     rows = 125"
## [1] "     rows = 126"
## [1] "     rows = 127"
## [1] "     rows = 128"
## [1] "     rows = 129"
## [1] "     rows = 130"
## [1] "     rows = 131"
## [1] "     rows = 132"
## [1] "     rows = 133"
## [1] "     rows = 134"
## [1] "     rows = 135"
## [1] "     rows = 136"
## [1] "     rows = 137"
## [1] "     rows = 138"
## [1] "     rows = 139"
## [1] "     rows = 140"
## [1] "     rows = 141"
## [1] "     rows = 142"
## [1] "     rows = 143"
## [1] "     rows = 144"
## [1] "     rows = 145"
## [1] "     rows = 146"
## [1] "     rows = 147"
## [1] "     rows = 148"
## [1] "     rows = 149"
## [1] "     rows = 150"
## [1] "     rows = 151"
## [1] "     rows = 152"
## [1] "     rows = 153"
## [1] "     rows = 154"
## [1] "     rows = 155"
## [1] "     rows = 156"
## [1] "     rows = 157"
## [1] "     rows = 158"
## [1] "     rows = 159"
## [1] "     rows = 160"
## [1] "     rows = 161"
## [1] "     rows = 162"
## [1] "     rows = 163"
## [1] "     rows = 164"
## [1] "     rows = 165"
## [1] "     rows = 166"
## [1] "     rows = 167"
## [1] "     rows = 168"
## [1] "     rows = 169"
## [1] "     rows = 170"
## [1] "     rows = 171"
## [1] "     rows = 172"
## [1] "     rows = 173"
## [1] "     rows = 174"
## [1] "     rows = 175"
## [1] "     rows = 176"
## [1] "     rows = 177"
## [1] "     rows = 178"
## [1] "     rows = 179"
## [1] "     rows = 180"
## [1] "     rows = 181"
## [1] "     rows = 182"
## [1] "     rows = 183"
## [1] "     rows = 184"
## [1] "     rows = 185"
## [1] "     rows = 186"
## [1] "     rows = 187"
## [1] "     rows = 188"
## [1] "     rows = 189"
## [1] "     rows = 190"
## [1] "     rows = 191"
## [1] "     rows = 192"
## [1] "     rows = 193"
## [1] "     rows = 194"
## [1] "     rows = 195"
## [1] "     rows = 196"
## [1] "     rows = 197"
## [1] "     rows = 198"
## [1] "     rows = 199"
## [1] "     rows = 200"
## [1] "     rows = 201"
## [1] "     rows = 202"
## [1] "     rows = 203"
## [1] "     rows = 204"
## [1] "     rows = 205"
## [1] "     rows = 206"
## [1] "     rows = 207"
## [1] "     rows = 208"
## [1] "     rows = 209"
## [1] "     rows = 210"
## [1] "     rows = 211"
## [1] "     rows = 212"
## [1] "     rows = 213"
## [1] "     rows = 214"
## [1] "     rows = 215"
## [1] "     rows = 216"
## [1] "     rows = 217"
## [1] "     rows = 218"
## [1] "     rows = 219"
## [1] "     rows = 220"
## [1] "     rows = 221"
## [1] "     rows = 222"
## [1] "     rows = 223"
## [1] "     rows = 224"
## [1] "     rows = 225"
## [1] "     rows = 226"
## [1] "     rows = 227"
## [1] "     rows = 228"
## [1] "     rows = 229"
## [1] "     rows = 230"
## [1] "     rows = 231"
## [1] "     rows = 232"
## [1] "     rows = 233"
## [1] "     rows = 234"
## [1] "     rows = 235"
## [1] "     rows = 236"
## [1] "     rows = 237"
## [1] "     rows = 238"
## [1] "     rows = 239"
## [1] "     rows = 240"
## [1] "     rows = 241"
## [1] "     rows = 242"
## [1] "     rows = 243"
## [1] "     rows = 244"
## [1] "     rows = 245"
## [1] "     rows = 246"
## [1] "     rows = 247"
## [1] "     rows = 248"
## [1] "     rows = 249"
## [1] "     rows = 250"
## [1] "     rows = 251"
## [1] "     rows = 252"
## [1] "     rows = 253"
## [1] "     rows = 254"
## [1] "     rows = 255"
## [1] "     rows = 256"
## [1] "     rows = 257"
## [1] "     rows = 258"
## [1] "     rows = 259"
## [1] "     rows = 260"
## [1] "     rows = 261"
## [1] "     rows = 262"
## [1] "     rows = 263"
## [1] "     rows = 264"
## [1] "     rows = 265"
## [1] "     rows = 266"
## [1] "     rows = 267"
## [1] "     rows = 268"
## [1] "     rows = 269"
## [1] "     rows = 270"
## [1] "     rows = 271"
## [1] "     rows = 272"
## [1] "     rows = 273"
## [1] "     rows = 274"
## [1] "     rows = 275"
## [1] "     rows = 276"
## [1] "     rows = 277"
## [1] "     rows = 278"
## [1] "     rows = 279"
## [1] "     rows = 280"
## [1] "     rows = 281"
## [1] "     rows = 282"
## [1] "     rows = 283"
## [1] "     rows = 284"
## [1] "     rows = 285"
## [1] "     rows = 286"
## [1] "     rows = 287"
## [1] "     rows = 288"
## [1] "     rows = 289"
## [1] "     rows = 290"
## [1] "     rows = 291"
## [1] "     rows = 292"
## [1] "     rows = 293"
## [1] "     rows = 294"
## [1] "     rows = 295"
## [1] "     rows = 296"
## [1] "     rows = 297"
## [1] "     rows = 298"
## [1] "     rows = 299"
## [1] "     rows = 300"
## [1] "     rows = 301"
## [1] "     rows = 302"
## [1] "     rows = 303"
## [1] "     rows = 304"
## [1] "     rows = 305"
## [1] "     rows = 306"
## [1] "     rows = 307"
## [1] "     rows = 308"
## [1] "     rows = 309"
## [1] "     rows = 310"
## [1] "     rows = 311"
## [1] "     rows = 312"
## [1] "     rows = 313"
## [1] "     rows = 314"
## [1] "     rows = 315"
## [1] "     rows = 316"
## [1] "     rows = 317"
## [1] "     rows = 318"
## [1] "     rows = 319"
## [1] "     rows = 320"
## [1] "     rows = 321"
## [1] "     rows = 322"
## [1] "     rows = 323"
## [1] "     rows = 324"
## [1] "     rows = 325"
## [1] "     rows = 326"
## [1] "     rows = 327"
## [1] "     rows = 328"
## [1] "     rows = 329"
## [1] "     rows = 330"
## [1] "     rows = 331"
## [1] "     rows = 332"
## [1] "     rows = 333"
## [1] "     rows = 334"
## [1] "     rows = 335"
## [1] "     rows = 336"
## [1] "     rows = 337"
## [1] "     rows = 338"
## [1] "     rows = 339"
## [1] "     rows = 340"
## [1] "     rows = 341"
## [1] "     rows = 342"
## [1] "     rows = 343"
## [1] "     rows = 344"
## [1] "     rows = 345"
## [1] "     rows = 346"
## [1] "     rows = 347"
## [1] "     rows = 348"
## [1] "     rows = 349"
## [1] "     rows = 350"
## [1] "     rows = 351"
## [1] "     rows = 352"
## [1] "     rows = 353"
## [1] "     rows = 354"
## [1] "     rows = 355"
## [1] "     rows = 356"
## [1] "     rows = 357"
## [1] "     rows = 358"
## [1] "     rows = 359"
## [1] "     rows = 360"
## [1] "     rows = 361"
## [1] "     rows = 362"
## [1] "     rows = 363"
## [1] "     rows = 364"
## [1] "     rows = 365"
## [1] "     rows = 366"
## [1] "     rows = 367"
## [1] "     rows = 368"
## [1] "     rows = 369"
## [1] "     rows = 370"
## [1] "     rows = 371"
## [1] "     rows = 372"
## [1] "     rows = 373"
## [1] "     rows = 374"
## [1] "     rows = 375"
## [1] "     rows = 376"
## [1] "     rows = 377"
## [1] "     rows = 378"
## [1] "     rows = 379"
## [1] "     rows = 380"
## [1] "     rows = 381"
## [1] "     rows = 382"
## [1] "     rows = 383"
## [1] "     rows = 384"
## [1] "     rows = 385"
## [1] "     rows = 386"
## [1] "     rows = 387"
## [1] "     rows = 388"
## [1] "     rows = 389"
## [1] "     rows = 390"
## [1] "     rows = 391"
## [1] "     rows = 392"
## [1] "     rows = 393"
## [1] "     rows = 394"
## [1] "     rows = 395"
## [1] "     rows = 396"
## [1] "     rows = 397"
## [1] "     rows = 398"
## [1] "     rows = 399"
## [1] "     rows = 400"
## [1] "     rows = 401"
## [1] "     rows = 402"
## [1] "     rows = 403"
## [1] "     rows = 404"
## [1] "     rows = 405"
## [1] "     rows = 406"
## [1] "     rows = 407"
## [1] "     rows = 408"
## [1] "     rows = 409"
## [1] "     rows = 410"
## [1] "     rows = 411"
## [1] "     rows = 412"
## [1] "     rows = 413"
## [1] "     rows = 414"
## [1] "     rows = 415"
## [1] "     rows = 416"
## [1] "     rows = 417"
## [1] "     rows = 418"
## [1] "     rows = 419"
## [1] "     rows = 420"
## [1] "     rows = 421"
## [1] "     rows = 422"
## [1] "     rows = 423"
## [1] "     rows = 424"
## [1] "     rows = 425"
## [1] "     rows = 426"
## [1] "     rows = 427"
## [1] "     rows = 428"
## [1] "     rows = 429"
## [1] "     rows = 430"
## [1] "     rows = 431"
## [1] "     rows = 432"
## [1] "     rows = 433"
## [1] "     rows = 434"
## [1] "     rows = 435"
## [1] "     rows = 436"
## [1] "     rows = 437"
## [1] "     rows = 438"
## [1] "     rows = 439"
## [1] "     rows = 440"
## [1] "     rows = 441"
## [1] "     rows = 442"
## [1] "     rows = 443"
## [1] "     rows = 444"
## [1] "     rows = 445"
## [1] "     rows = 446"
## [1] "     rows = 447"
## [1] "     rows = 448"
## [1] "     rows = 449"
## [1] "     rows = 450"
## [1] "     rows = 451"
## [1] "     rows = 452"
## [1] "     rows = 453"
## [1] "     rows = 454"
## [1] "     rows = 455"
## [1] "     rows = 456"
## [1] "     rows = 457"
## [1] "     rows = 458"
## [1] "     rows = 459"
## [1] "     rows = 460"
## [1] "     rows = 461"
## [1] "     rows = 462"
## [1] "     rows = 463"
## [1] "     rows = 464"
## [1] "     rows = 465"
## [1] "     rows = 466"
## [1] "     rows = 467"
## [1] "     rows = 468"
## [1] "     rows = 469"
## [1] "     rows = 470"
## [1] "     rows = 471"
## [1] "     rows = 472"
## [1] "     rows = 473"
## [1] "     rows = 474"
## [1] "     rows = 475"
## [1] "     rows = 476"
## [1] "     rows = 477"
## [1] "     rows = 478"
## [1] "     rows = 479"
## [1] "     rows = 480"
## [1] "     rows = 481"
## [1] "     rows = 482"
## [1] "     rows = 483"
## [1] "     rows = 484"
## [1] "     rows = 485"
## [1] "     rows = 486"
## [1] "     rows = 487"
## [1] "     rows = 488"
## [1] "     rows = 489"
## [1] "     rows = 490"
## [1] "     rows = 491"
## [1] "     rows = 492"
## [1] "     rows = 493"
## [1] "     rows = 494"
## [1] "     rows = 495"
## [1] "     rows = 496"
## [1] "     rows = 497"
## [1] "     rows = 498"
## [1] "     rows = 499"
## [1] "     rows = 500"
## [1] "     rows = 501"
## [1] "     rows = 502"
## [1] "     rows = 503"
## [1] "     rows = 504"
## [1] "     rows = 505"
## [1] "     rows = 506"
## [1] "     rows = 507"
## [1] "     rows = 508"
## [1] "     rows = 509"
## [1] "     rows = 510"
## [1] "     rows = 511"
## [1] "     rows = 512"
## [1] "     rows = 513"
## [1] "     rows = 514"
## [1] "     rows = 515"
## [1] "     rows = 516"
## [1] "     rows = 517"
## [1] "     rows = 518"
## [1] "     rows = 519"
## [1] "     rows = 520"
## [1] "     rows = 521"
## [1] "     rows = 522"
## [1] "     rows = 523"
## [1] "     rows = 524"
## [1] "     rows = 525"
## [1] "     rows = 526"
## [1] "     rows = 527"
## [1] "     rows = 528"
## [1] "     rows = 529"
## [1] "     rows = 530"
## [1] "     rows = 531"
## [1] "     rows = 532"
## [1] "     rows = 533"
## [1] "     rows = 534"
## [1] "     rows = 535"
## [1] "     rows = 536"
## [1] "     rows = 537"
## [1] "     rows = 538"
## [1] "     rows = 539"
## [1] "     rows = 540"
## [1] "     rows = 541"
## [1] "     rows = 542"
## [1] "     rows = 543"
## [1] "     rows = 544"
## [1] "     rows = 545"
## [1] "     rows = 546"
## [1] "     rows = 547"
## [1] "     rows = 548"
## [1] "     rows = 549"
## [1] "     rows = 550"
## [1] "     rows = 551"
## [1] "     rows = 552"
## [1] "     rows = 553"
## [1] "     rows = 554"
## [1] "     rows = 555"
## [1] "     rows = 556"
## [1] "     rows = 557"
## [1] "     rows = 558"
## [1] "     rows = 559"
## [1] "     rows = 560"
## [1] "     rows = 561"
## [1] "     rows = 562"
## [1] "     rows = 563"
## [1] "     rows = 564"
## [1] "     rows = 565"
## [1] "     rows = 566"
## [1] "     rows = 567"
## [1] "     rows = 568"
## [1] "     rows = 569"
## [1] "     rows = 570"
## [1] "     rows = 571"
## [1] "     rows = 572"
## [1] "     rows = 573"
## [1] "     rows = 574"
## [1] "     rows = 575"
## [1] "     rows = 576"
## [1] "     rows = 577"
## [1] "     rows = 578"
## [1] "     rows = 579"
## [1] "     rows = 580"
## [1] "     rows = 581"
## [1] "     rows = 582"
## [1] "     rows = 583"
## [1] "     rows = 584"
## [1] "     rows = 585"
## [1] "     rows = 586"
## [1] "     rows = 587"
## [1] "     rows = 588"
## [1] "     rows = 589"
## [1] "     rows = 590"
## [1] "     rows = 591"
## [1] "     rows = 592"
## [1] "     rows = 593"
## [1] "     rows = 594"
## [1] "     rows = 595"
## [1] "     rows = 596"
## [1] "     rows = 597"
## [1] "     rows = 598"
## [1] "     rows = 599"
## [1] "     rows = 600"
## [1] "     rows = 601"
## [1] "     rows = 602"
## [1] "     rows = 603"
## [1] "     rows = 604"
## [1] "     rows = 605"
## [1] "     rows = 606"
## [1] "     rows = 607"
## [1] "     rows = 608"
## [1] "     rows = 609"
## [1] "     rows = 610"
## [1] "     rows = 611"
## [1] "     rows = 612"
## [1] "     rows = 613"
## [1] "     rows = 614"
## [1] "     rows = 615"
## [1] "     rows = 616"
## [1] "     rows = 617"
## [1] "     rows = 618"
## [1] "     rows = 619"
## [1] "     rows = 620"
## [1] "     rows = 621"
## [1] "     rows = 622"
## [1] "     rows = 623"
## [1] "     rows = 624"
## [1] "     rows = 625"
## [1] "     rows = 626"
## [1] "     rows = 627"
## [1] "     rows = 628"
## [1] "     rows = 629"
## [1] "     rows = 630"
## [1] "     rows = 631"
## [1] "     rows = 632"
## [1] "     rows = 633"
## [1] "     rows = 634"
## [1] "     rows = 635"
## [1] "     rows = 636"
## [1] "     rows = 637"
## [1] "     rows = 638"
## [1] "     rows = 639"
## [1] "     rows = 640"
## [1] "     rows = 641"
## [1] "     rows = 642"
## [1] "     rows = 643"
## [1] "     rows = 644"
## [1] "     rows = 645"
## [1] "     rows = 646"
## [1] "     rows = 647"
## [1] "     rows = 648"
## [1] "     rows = 649"
## [1] "     rows = 650"
## [1] "     rows = 651"
## [1] "     rows = 652"
## [1] "     rows = 653"
## [1] "     rows = 654"
## [1] "     rows = 655"
## [1] "     rows = 656"
## [1] "     rows = 657"
## [1] "     rows = 658"
## [1] "     rows = 659"
## [1] "     rows = 660"
## [1] "     rows = 661"
## [1] "     rows = 662"
## [1] "     rows = 663"
## [1] "     rows = 664"
## [1] "     rows = 665"
## [1] "     rows = 666"
## [1] "     rows = 667"
## [1] "     rows = 668"
## [1] "     rows = 669"
## [1] "     rows = 670"
## [1] "     rows = 671"
## [1] "     rows = 672"
## [1] "     rows = 673"
## [1] "     rows = 674"
## [1] "     rows = 675"
## [1] "     rows = 676"
## [1] "     rows = 677"
## [1] "     rows = 678"
## [1] "     rows = 679"
## [1] "     rows = 680"
## [1] "     rows = 681"
## [1] "     rows = 682"
## [1] "     rows = 683"
## [1] "     rows = 684"
## [1] "     rows = 685"
## [1] "     rows = 686"
## [1] "     rows = 687"
## [1] "     rows = 688"
## [1] "     rows = 689"
## [1] "     rows = 690"
## [1] "     rows = 691"
## [1] "     rows = 692"
## [1] "     rows = 693"
## [1] "     rows = 694"
## [1] "     rows = 695"
## [1] "     rows = 696"
## [1] "     rows = 697"
## [1] "     rows = 698"
## [1] "     rows = 699"
## [1] "     rows = 700"
## [1] "     rows = 701"
## [1] "     rows = 702"
## [1] "     rows = 703"
## [1] "     rows = 704"
## [1] "     rows = 705"
## [1] "     rows = 706"
## [1] "     rows = 707"
## [1] "     rows = 708"
## [1] "     rows = 709"
## [1] "     rows = 710"
## [1] "     rows = 711"
## [1] "     rows = 712"
## [1] "     rows = 713"
## [1] "     rows = 714"
## [1] "     rows = 715"
## [1] "     rows = 716"
## [1] "     rows = 717"
## [1] "     rows = 718"
## [1] "     rows = 719"
## [1] "     rows = 720"
## [1] "     rows = 721"
## [1] "     rows = 722"
## [1] "     rows = 723"
## [1] "     rows = 724"
## [1] "     rows = 725"
## [1] "     rows = 726"
## [1] "     rows = 727"
## [1] "     rows = 728"
## [1] "     rows = 729"
## [1] "     rows = 730"
## [1] "     rows = 731"
## [1] "     rows = 732"
## [1] "     rows = 733"
## [1] "     rows = 734"
## [1] "     rows = 735"
## [1] "     rows = 736"
## [1] "     rows = 737"
## [1] "     rows = 738"
## [1] "     rows = 739"
## [1] "     rows = 740"
## [1] "     rows = 741"
## [1] "     rows = 742"
## [1] "     rows = 743"
## [1] "     rows = 744"
## [1] "     rows = 745"
## [1] "     rows = 746"
## [1] "     rows = 747"
## [1] "     rows = 748"
## [1] "     rows = 749"
## [1] "     rows = 750"
## [1] "     rows = 751"
## [1] "     rows = 752"
## [1] "     rows = 753"
## [1] "     rows = 754"
## [1] "     rows = 755"
## [1] "     rows = 756"
## [1] "     rows = 757"
## [1] "     rows = 758"
## [1] "     rows = 759"
## [1] "     rows = 760"
## [1] "     rows = 761"
## [1] "     rows = 762"
## [1] "     rows = 763"
## [1] "     rows = 764"
## [1] "     rows = 765"
## [1] "     rows = 766"
## [1] "     rows = 767"
## [1] "     rows = 768"
## [1] "     rows = 769"
## [1] "     rows = 770"
## [1] "     rows = 771"
## [1] "     rows = 772"
## [1] "     rows = 773"
## [1] "     rows = 774"
## [1] "     rows = 775"
## [1] "     rows = 776"
## [1] "     rows = 777"
## [1] "     rows = 778"
## [1] "     rows = 779"
## [1] "     rows = 780"
## [1] "     rows = 781"
## [1] "     rows = 782"
## [1] "     rows = 783"
## [1] "     rows = 784"
## [1] "     rows = 785"
## [1] "     rows = 786"
## [1] "     rows = 787"
## [1] "     rows = 788"
## [1] "     rows = 789"
## [1] "     rows = 790"
## [1] "     rows = 791"
## [1] "     rows = 792"
## [1] "     rows = 793"
## [1] "     rows = 794"
## [1] "     rows = 795"
## [1] "     rows = 796"
## [1] "     rows = 797"
## [1] "     rows = 798"
## [1] "     rows = 799"
## [1] "     rows = 800"
## [1] "     rows = 801"
## [1] "     rows = 802"
## [1] "     rows = 803"
## [1] "     rows = 804"
## [1] "     rows = 805"
## [1] "     rows = 806"
## [1] "     rows = 807"
## [1] "     rows = 808"
## [1] "     rows = 809"
## [1] "     rows = 810"
## [1] "     rows = 811"
## [1] "     rows = 812"
## [1] "     rows = 813"
## [1] "     rows = 814"
## [1] "     rows = 815"
## [1] "     rows = 816"
## [1] "     rows = 817"
## [1] "     rows = 818"
## [1] "     rows = 819"
## [1] "     rows = 820"
## [1] "     rows = 821"
## [1] "     rows = 822"
## [1] "     rows = 823"
## [1] "     rows = 824"
## [1] "     rows = 825"
## [1] "     rows = 826"
## [1] "     rows = 827"
## [1] "     rows = 828"
## [1] "     rows = 829"
## [1] "     rows = 830"
## [1] "     rows = 831"
## [1] "     rows = 832"
## [1] "     rows = 833"
## [1] "     rows = 834"
## [1] "     rows = 835"
## [1] "     rows = 836"
## [1] "     rows = 837"
## [1] "     rows = 838"
## [1] "     rows = 839"
## [1] "     rows = 840"
## [1] "     rows = 841"
## [1] "     rows = 842"
## [1] "     rows = 843"
## [1] "     rows = 844"
## [1] "     rows = 845"
## [1] "     rows = 846"
## [1] "     rows = 847"
## [1] "     rows = 848"
## [1] "     rows = 849"
## [1] "     rows = 850"
## [1] "     rows = 851"
## [1] "     rows = 852"
## [1] "     rows = 853"
## [1] "     rows = 854"
## [1] "     rows = 855"
## [1] "     rows = 856"
## [1] "     rows = 857"
## [1] "     rows = 858"
## [1] "     rows = 859"
## [1] "     rows = 860"
## [1] "     rows = 861"
## [1] "     rows = 862"
## [1] "     rows = 863"
## [1] "     rows = 864"
## [1] "     rows = 865"
## [1] "     rows = 866"
## [1] "     rows = 867"
## [1] "     rows = 868"
## [1] "     rows = 869"
## [1] "     rows = 870"
## [1] "     rows = 871"
## [1] "     rows = 872"
## [1] "     rows = 873"
## [1] "     rows = 874"
## [1] "     rows = 875"
## [1] "     rows = 876"
## [1] "     rows = 877"
## [1] "     rows = 878"
## [1] "     rows = 879"
## [1] "     rows = 880"
## [1] "     rows = 881"
## [1] "     rows = 882"
## [1] "     rows = 883"
## [1] "     rows = 884"
## [1] "     rows = 885"
## [1] "     rows = 886"
## [1] "     rows = 887"
## [1] "     rows = 888"
## [1] "     rows = 889"
## [1] "     rows = 890"
## [1] "     rows = 891"
## [1] "     rows = 892"
## [1] "     rows = 893"
## [1] "     rows = 894"
## [1] "     rows = 895"
## [1] "     rows = 896"
## [1] "     rows = 897"
## [1] "     rows = 898"
## [1] "     rows = 899"
## [1] "     rows = 900"
## [1] "     rows = 901"
## [1] "     rows = 902"
## [1] "     rows = 903"
## [1] "     rows = 904"
## [1] "     rows = 905"
## [1] "     rows = 906"
## [1] "     rows = 907"
## [1] "     rows = 908"
## [1] "     rows = 909"
## [1] "     rows = 910"
## [1] "     rows = 911"
## [1] "     rows = 912"
## [1] "     rows = 913"
## [1] "     rows = 914"
## [1] "     rows = 915"
## [1] "     rows = 916"
## [1] "     rows = 917"
## [1] "     rows = 918"
## [1] "     rows = 919"
## [1] "     rows = 920"
## [1] "     rows = 921"
## [1] "     rows = 922"
## [1] "     rows = 923"
## [1] "     rows = 924"
## [1] "     rows = 925"
## [1] "     rows = 926"
## [1] "     rows = 927"
## [1] "     rows = 928"
## [1] "     rows = 929"
## [1] "     rows = 930"
## [1] "     rows = 931"
## [1] "     rows = 932"
## [1] "     rows = 933"
## [1] "     rows = 934"
## [1] "     rows = 935"
## [1] "     rows = 936"
## [1] "     rows = 937"
## [1] "     rows = 938"
## [1] "     rows = 939"
## [1] "     rows = 940"
## [1] "     rows = 941"
## [1] "     rows = 942"
## [1] "     rows = 943"
## [1] "     rows = 944"
## [1] "     rows = 945"
## [1] "     rows = 946"
## [1] "     rows = 947"
## [1] "     rows = 948"
## [1] "     rows = 949"
## [1] "     rows = 950"
## [1] "     rows = 951"
## [1] "     rows = 952"
## [1] "     rows = 953"
## [1] "     rows = 954"
## [1] "     rows = 955"
## [1] "     rows = 956"
## [1] "     rows = 957"
## [1] "     rows = 958"
## [1] "ARGfn: C:/TUTORIAL IMAGE CLASSIFICATION IN r/Third draff_Mar_23_2018/VModelMapEx3_map_mapmake_arguments.txt"

To read the map

Sentinel.map.RF = stack("VModelMapEx3_map.img")
plot(Sentinel.map.RF)

To read the codes of the map

MAP.CODES<-read.table( paste(MODELfn,"_map_key.csv",sep=""),
                       header=TRUE,
                       sep=",",
                       stringsAsFactors=FALSE)
MAP.CODES
##   row      category integercode
## 1   1          Bare           1
## 2   2 DeciduousTree           2
## 3   3     Developed           3
## 4   4     GambelOak           4
## 5   5     Grassland           5
## 6   6       Juniper           6
## 7   7     Sagebrush           7

Questions

In the clustering classification:

  1. How many pixels are groping in the third cluster? (Answer = 8076 pixels)
  2. What is the mean for the near infrared for the twelfth cluster? (Answer = 2251.497)
  3. What is the cluster group (cluster groups are 12, from 1 to 12) of the first pixel of the first row in the left of the image? (Answer = 10)

In the random forest classification

After running this tutorial, the Model diagnosis produced several files on the working directory (the results of the classification). Based on these files, you should answer three questions below. Note: I suggest read Fielding et al. (1997) to respond the first question.

  1. What was the accuracy of the random forest classification? In other words, what is the accuracy of your map? (Answer = 0.640447). Do you think that the classification accuracy was low, good, or high?
  2. What means commission error? What is the land cover with the highest commission error? (Answer=0.37 for the land cover Juniper).
  3. What means omission error? What is the land cover with the lowest commission error? (Answer= 0.1 for the land cover GambelOak).

Cited literature

Breiman, L. & Cutler, A. (2015) Package “randomForest.” r-project.org, Breiman, L. & Cutler, A. (2018) Available at: https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm.

Campbell, J.B. & Wynne, R.H. (2011) Introduction to Remote Sensing. The Guilford Press, New York, US.

Cantly, M. (2006) Image analysis, classification and change detection in remote sensing. Taylor & Francis, New York, US.

Cutler, D.R., Edwards, T.C., Beard, K.H., Cutler, A., & Hess, K.T. (2007) Random forests for classification in ecology. Ecology, 88, 2783-2792.

Dahms, T. (2016) Available at: http://remote-sensing.eu/unsupervised-classification-with-r/.

Fielding, A.H. & Bell, J.F. (1997) A review of methods for the assessment of prediction errors in conservation presence/absence models. Environmental Conservation, 24, 38-49.

Freema, A.E., Frescino, T.S., & Moisen, G.G. (2016) ModelMap: an R Package for Model Creation and Map Production. r-project.org.

Hartigan, J.A. & Wong, M.A. (1979) Algorithm AS 136: A K-Means Clustering Algorithm. Journal of the Royal Statistical Society. Series C (Applied Statistics), 28, 100-108.

Hastie, T., Tibshirani, R., & Friedman, J. (2009) The Elements of Statistical Learning Data. Stanford, California, US.